// 在这里面定义所有接口，一个文件管理所有接口，易于维护
import {
  http
} from './http'; // 引入刚刚封装好的http模块，import属于ES6的语法，微信开发者工具必须打开ES6转ES5选项

//获取openid
function getOpenId(postData, doSuccess, doFail, doComplete) {
  http('/wx/getOpenId', 'post', postData, doSuccess, doFail, doComplete)
}

function getDataByOpenId(postData, doSuccess, doFail, doComplete) {
  http('user/getDataByOpenId', 'post', postData, doSuccess, doFail, doComplete)
}

function save(postData, doSuccess, doFail, doComplete) {
  http('user/save', 'post', postData, doSuccess, doFail, doComplete)
}


function getAppointmentRecord(postData, doSuccess, doFail, doComplete) {
  http('/user/getAppointmentRecord', 'post', postData, doSuccess, doFail, doComplete)
}
//获取司机列表
function getDriver(postData, doSuccess, doFail, doComplete) {
  http('user/getDriver', 'post', postData, doSuccess, doFail, doComplete)
}
// 编辑司机信息
function driverupdateById(postData, doSuccess, doFail, doComplete) {
  http('driver/updateById', 'post', postData, doSuccess, doFail, doComplete)
}
// 新建司机信息
function driversave(postData, doSuccess, doFail, doComplete) {
  http('driver/save', 'post', postData, doSuccess, doFail, doComplete)
}
// 删除司机信息
function driverdel(postData, doSuccess, doFail, doComplete) {
  http('driver/del', 'post', postData, doSuccess, doFail, doComplete)
}

//用户列表
function userlist(postData, doSuccess, doFail, doComplete) {
  http('user/list', 'post', postData, doSuccess, doFail, doComplete)
}

//用户列表
function userBindRole(postData, doSuccess, doFail, doComplete) {
  http('user/userBindRole', 'post', postData, doSuccess, doFail, doComplete)
}


// 删除
function userdel(postData, doSuccess, doFail, doComplete) {
  http('user/del', 'post', postData, doSuccess, doFail, doComplete)
}
//用户列表
function getphone(postData, doSuccess, doFail, doComplete) {
  http('wx/getPhone', 'post', postData, doSuccess, doFail, doComplete)
}


function getUserByName(postData, doSuccess, doFail, doComplete) {
  http('/user/getUserByName', 'post', postData, doSuccess, doFail, doComplete)
}

export default { // 暴露接口
  getOpenId,
  getDataByOpenId,
  save,
  getAppointmentRecord,
  getDriver,
  driverupdateById,
  driversave,
  driverdel,
  userlist,
  userBindRole,
  userdel,
  getphone,
  getUserByName
}